/**
 * 下载二进制文件
 * @param {Blob} blob
 * @param {string} filename
 * @return void
 */
export const downloadFileBlob = (blob: Blob, filename: string): void => {
  const newBlob = new Blob([blob]);
  const downloadElement = document.createElement('a');
  const href = window.URL.createObjectURL(newBlob);
  downloadElement.href = href;
  downloadElement.download = decodeURIComponent(filename);
  document.body.appendChild(downloadElement);
  downloadElement.click();
  document.body.removeChild(downloadElement);
  window.URL.revokeObjectURL(href);
};
